﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Windows;
#if WPF
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Markup;
using System.Windows.Data;
#else
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Imaging;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Shapes;
using Windows.Foundation;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Markup;
using Windows.UI;
#endif

namespace Eternal.DataVisualization
{

    public class NonAxisTypeCollection : ObservableCollection<NonAxisType>
    {
    }

    public class SeriesCollection : ObservableCollection<Series>
    {
    }

    public class AxisTypeCollection : ObservableCollection<AxisType>
    {
    }

    public class SegmentBrushConverter : IValueConverter
    {
        static List<Brush> brushes=new List<Brush>();

        static private bool isBrushUpdated;

        public SegmentBrushConverter()
        {
          if(!isBrushUpdated)
              UpdateBrush();
        }

        public static Brush GetBrush(int index)
        {
            if (!isBrushUpdated)
               UpdateBrush();
            return brushes[index];
        }

        private static void UpdateBrush()
        {
            brushes.Add(new SolidColorBrush(Color.FromArgb(255,91, 155, 213)));
            brushes.Add(new SolidColorBrush(Color.FromArgb(255, 237, 200, 126)));
            brushes.Add(new SolidColorBrush(Color.FromArgb(255, 128, 128, 128)));
            isBrushUpdated = true;
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return brushes[(int) parameter%3];
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        public object Convert(object value, Type targetType, object parameter, string language)
        {
            return brushes[(int)parameter % 3];
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }

}
